<?php

    function UnitUserLogin( tString $username, tString $password, tCoalaPointer $callback ) {
        global $server;

        $db = New BabooDatabase();
        $db->Connect( $server[ 'address' ] );
        $db->Authenticate( $username, $password );
        if ( $db->TestConnect() ) {
            setcookie( 'baboo_user', "$username:$password", time() + 60 * 60 * 24 * 30 );
            echo $callback;
            ?>( true );<?php
        }
        else {
            echo $callback;
            ?>( false );<?php
        }
    }

?>
